class RpcException(Exception):
  def __init__(self, text, code=None):
    self._code = code
    self._text = text

  def code(self):
    return self._code

  def text(self):
    return self._text

  def __str__(self):
    params = []
    if self._code:
    	params.append(str(self._code))
    if self._text:
    	params.append(str(self._text))
    return 'RpcException(%s)' % ', '.join(params)
